/**
 * 2018年12月23日上午11:11:12
 * @author 谢进财
 */
package com.baihang.platform.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baihang.framework.kit.JsonKit;
import com.baihang.framework.service.BaseService;
import com.baihang.platform.dao.GroupDao;
import com.baihang.platform.entity.GroupEntity;

/**
 * @author whati
 *
 */
@Service
public class GroupService extends BaseService {
	@Autowired
	private GroupDao dao;
	
	public String getGroupJson() {
		List<GroupEntity> list = dao.getGroupEntityList("select * from system_group where parentGroupId='0'");
		//String id = dao.queryForString("select id from system_group where parentGroupId='0' limit 1");
		List<GroupEntity> listSon = dao.getGroupEntityList(String.format("select * from system_group where id='%s'",list.get(0).getId()));
		if(listSon != null) {
			list.get(0).setChildren(listSon);
		}
		
		return JsonKit.listToJson(list, 1);
	}
	
}
